<template>
    <v-card>
        <v-flex xs12 sm10>
            <v-tree url="/item/category/list"
                    :isEdit="isEdit"
                    @handleAdd="handleAdd"
                    @handleEdit="handleEdit"
                    @handleDelete="handleDelete"
                    @handleClick="handleClick"
            />
        </v-flex>
    </v-card>
</template>

<script>
    export default {
        name: "category",
        data() {
            return {
                isEdit: true
            }
        },
        methods: {
            handleAdd(node) {
                console.log("add .... ");
                console.log(node);
                this.$http.post('/item/category', this.$qs.stringify(node));
            },
            handleEdit(id, name) {
                console.log("edit... id: " + id + ", name: " + name);
                this.$http.put('/item/category', this.$qs.stringify({
                    id: id,
                    name: name
                }));
            },
            handleDelete(id) {
                console.log("delete ... " + id);
                this.$http.get('/item/category/del/' + id);
            },
            handleClick(node) {
                // console.log(node);
            }
        }
    };
</script>

<style scoped>

</style>
